#define _CRT_SECURE_NO_WARNINGS  1

#include"list.h"

void list_test1()
{
	lsh::list<int> l1;
	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_back(4);

	l1.push_front(0);
	l1.push_front(-1);
	l1.push_front(-2);

	for (auto ch : l1)
	{
		cout << ch << ' ';
	}
	cout << endl;
}

void list_test2()
{
	lsh::list<int> l1;

	l1.insert(l1.begin(), 0);
	l1.insert(l1.begin() + 1, 1);


	for (auto ch : l1)
	{
		cout << ch << ' ';
	}
	cout << endl;
}


void list_test3()
{
	lsh::list<int> l1;

	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_back(4);

	l1.erase(l1.begin());
	l1.erase(l1.begin());
	l1.erase(l1.begin());

	for (auto ch : l1)
	{
		cout << ch << ' ';
	}
	cout << endl;
}


void list_test4()
{
	lsh::list<int> l1;

	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_back(4);
	
	l1.pop_back();
	for (auto ch : l1)
	{
		cout << ch << ' ';
	}
	cout << endl;
}


void list_test5()
{
	lsh::list<int> l1;

	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_back(4);

	l1.pop_back();
	l1.pop_front();
	for (auto ch : l1)
	{
		cout << ch << ' ';
	}
	cout << endl;
}

void list_test6()
{
	lsh::list<int> l1;

	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_back(4);

	l1.clear();

	for (auto ch : l1)
	{
		cout << ch << ' ';
	}
	cout << endl;
}


void list_test7()
{
	lsh::list<int> l1;

	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_back(4);

	lsh::list<int> l2(l1);
	lsh::list<int> l3;
	l3 = l1;
	for (auto ch : l2)
	{
		cout << ch << ' ';
	}
	cout << endl;
	for (auto ch : l3)
	{
		cout << ch << ' ';
	}
}

void list_test8()
{
	lsh::list<int> l1;

	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_back(4);
	lsh::list<int>::reverse_iterator rit = l1.rbegin();
	while (rit != l1.rend())
	{
		cout << *rit << ' ';
			++rit;
	}
	cout << endl;
}

	

int main()
{
	list_test8();
	
	return 0;
	
}